A Portable C Interface for Standard ML of New Jersey

نویسنده

  • Lorenz Huelsbergen
چکیده

This paper describes the design and implementation of an interface to C for the SML/NJ ML compiler. The interface supplies ML datatypes with which programmers specify C types and C data. An ML program uses these datatypes to register a foreign C function with the interface and to build speci cations of structured C data. The interface automatically instantiates C function arguments from C data speci cations upon foreign function application. Most C types, including aggregate and functionpointer types, are supported. A runtime code generation technique converts ML closures to C-callable function pointers. Function pointers allow C programs to call ML programs. We solve the problems due to di erences in data representation, function calling conventions, and storage management by copying data between the ML and C heaps, converting representations and changing calling conventions in the process. We nd that this copying strategy provides adequate performance in practice. The interface is portable in the sense that its implementation does not require changes to the SML/NJ compiler proper; it is isolated in a pair of libraries (ML and C). The interface has already found use in several non-trivial applications.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A Portable Multiprocessor Interface for Standard Ml of New Jersey

We have designed a portable interface between shared-memory multiprocessors and Standard ML of New Jersey. The interface is based on the conventional kernel thread model and provides facilities that can be used to implement user-level thread packages. The interface supports experimentation with diierent thread scheduling policies and synchronization constructs. It has been ported to three diier...

متن کامل

Persistence + undoability = transactions

Persistence means objects live potentially forever. Undoability means that any change to a program's store can potentially be undone. In our design and implementation of support for single-threaded nested transactions in Standard ML of New Jersey (SML/NJ), we provide persistence and undoability as orthogonal features and combine them in a simple and elegant manner. We provide support for persis...

متن کامل

A Debugger for Standard Ml 1

We have built a portable, instrumentation-based, replay debugger for the Standard ML of New Jersey compiler. Traditional \source-level" debuggers for compiled languages actually operate at machine level, which makes them complex, diicult to port, and intolerant of compiler optimization. For secure languages like ML, however, debugging support can be provided without reference to the underlying ...

متن کامل

A Compilation Manager for Standard ML of New Jersey

The design and implementation of a compilation manager (CM) for Standard ML of New Jersey (SML/NJ) is described. Truly independent compilation is difficult to implement correctly and efficiently for SML because one compilation unit may depend not only on the interface of another, but also on its implementation. In this paper we present an integrated compilation system based on the “visible comp...

متن کامل

Incremental Recompilation for Standard ML of New Jersey

The design and implementation of an incremental recompilation manager (IRM) for Standard ML of New Jersey (SML/NJ) is described. Truly separate compilation is diicult to implement correctly and eeciently for SML because one compilation unit may depend not only on the interface of another, but also on its implementation. In this paper we present an integrated compilation system based on the \vis...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1996